import { createRouter, createWebHashHistory } from "vue-router";

// 固定路由
const constantRoutes = [
  //首页
  {
    path: "",
    redirect: "/main",
  },
  //main
  {
    path: "/main",
    component: () => import("@/views/home/index.vue"),
  },
  //测试
  {
    path: "/test/imageDownload",
    component: () => import("@/views/test/TestImageDownload.vue"),
  },
  {
    path: "/test/fileDraggFile",
    component: () => import("@/views/test/TestFileDraggFile.vue"),
  },
  {
    path: "/test/execCmd",
    component: () => import("@/views/test/TestExecCmd.vue"),
  },
  {
    path: "/test/fileDraggWords",
    component: () => import("@/views/test/TestFileDraggWords.vue"),
  },
];

//路由实例
const router = createRouter({
  history: createWebHashHistory(import.meta.env.BASE_URL),
  routes: constantRoutes,
});

//生成路由守卫
router.beforeEach((to, from, next) => {
  next();
});

export default router;
